#include <gtk/gtk.h>
#include <webkit/webkit.h>

int main(int argc,char *argv[])
{
    GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    GtkWidget *scrolledWindow = gtk_scrolled_window_new(NULL, NULL);
    GtkWidget *webView = webkit_web_view_new();
    GdkColor color_black_ = {0x0, 0x0, 0x0, 0x0};
    
    gtk_init(&argc,&argv);
    
    /* window */
    gtk_window_set_title(GTK_WINDOW(window), "WebView");
    
#if 1
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);	/*设置不提供装饰*/
    gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);	/*设置窗口大小*/
    gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
#else
    gtk_window_fullscreen(GTK_WINDOW(window));	/*设置全屏*/
#endif

    gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color_black_); /*设置为黑色背景*/

    g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL);
    
    gtk_container_add(GTK_CONTAINER(scrolledWindow), webView);
    gtk_container_add(GTK_CONTAINER(window), scrolledWindow);

//    webkit_web_view_load_uri (WEBKIT_WEB_VIEW(webView), "http://www.baidu.com");
    webkit_web_view_load_uri (WEBKIT_WEB_VIEW(webView), "file:///tmp/test.html");
    
    gtk_widget_show_all(window);
    
    gtk_main();
    
    return 0;
} 
